Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(difs): Add debug status to dif candidates info #316

Merged
merged 1 commit into from
Dec 18, 2020

Conversation

flub
Copy link
Contributor

@flub flub commented Dec 3, 2020

No description provided.

@flub flub requested a review from a team December 3, 2020 16:43
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2020

Warnings
⚠️ Snapshot changes likely affect Sentry tests. Please check the symbolicator test suite in Sentry and update snapshots as needed.
Instructions for snapshot changes

Sentry runs a symbolicator integration test suite located at tests/symbolicator/. Changes in this PR will likely result in snapshot diffs in Sentry, which will break the master branch and in-progress PRs.

Follow these steps to update snapshots in Sentry:

  1. Check out latest Sentry master and enable the virtualenv.
  2. Stop the symbolicator devservice using sentry devservices down symbolicator.
  3. Run your development symbolicator on port 3021.
  4. Export SENTRY_SNAPSHOTS_WRITEBACK=1 and run symbolicator tests with pytest.
  5. Review snapshot changes locally, then create a PR to Sentry.
  6. Merge the Symbolicator PR, then merge the Sentry PR.

Generated by 🚫 dangerJS against b385b43

src/types/mod.rs Outdated Show resolved Hide resolved
}
}

impl From<Vec<ObjectCandidate>> for AllObjectCandidates {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe IntoIterator<ObjectCandidate> would be a better bound?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way this can move the Vec rather than re-create it. And this happens to already be created as a Vec, so I don't think there's anything to be gained from being more generic here.

Maybe this should be a ::new method intead? I'm not really sure when new is preferred.


impl From<Vec<ObjectCandidate>> for AllObjectCandidates {
fn from(mut source: Vec<ObjectCandidate>) -> Self {
source.sort_by_key(|candidate| (candidate.source.clone(), candidate.location.clone()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say:

For expensive key functions (e.g. functions that are not simple property accesses or basic operations), sort_by_cached_key is likely to be significantly faster, as it does not recompute element keys.

Since at least location.clone() allocates a new string, you should try to optimize this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, didn't spot the cached version.

This cloning is annoying, I didn't know what to do better about this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, why can’t you just use (&candidate.source, &candidate.location)? oh yes, because sort is mut, or does it basically take care of that internally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the tuple that makes this impossible.

match self
.0
.binary_search_by_key(&(source, location), |candidate| {
(candidate.source.clone(), candidate.location.clone())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the same applies here. Maybe factoring out the sorting function would be a good idea, as that would also format this a lot nicer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what your suggestion is here. There is no cached variant, which is probably because this never needs to compute the same key twice. As this is currently only in the From and here I don't think it's worth further factoring out. Once this grows more methods, like .set_unwind() that'll probably change though at which point I think it makes more sense to do that.

src/types/objects.rs Outdated Show resolved Hide resolved
@Swatinem
Copy link
Member

Swatinem commented Dec 7, 2020

just curious, since you have so many snapshot changes: is the sorting of the candidates stable? should it be? or just for the tests at least?

@flub
Copy link
Contributor Author

flub commented Dec 9, 2020

just curious, since you have so many snapshot changes: is the sorting of the candidates stable? should it be? or just for the tests at least?

Since this commit it explicitly is, since it now sorts on (sourceid, location). So this is hopefully the last time this order is completely changed in all the snapshot changes.

Base automatically changed from feat/dif-info to master December 16, 2020 14:56
This updates the symcache to also add the debug status to the DIF
candidates list returned in the modules list.  It introduces a newtype
to handle all the candidates and re-arranges where impls of types live
a little.
@flub
Copy link
Contributor Author

flub commented Dec 16, 2020

So this went through a bit of a git hell after the target branch got merged into master. The diff is now correct again and is reviewable. Please do so. 👼

Copy link
Member

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to find a solution to the excessive cloning, but I think this is fine for a first pass

@flub flub merged commit a7dbbb0 into master Dec 18, 2020
@flub flub deleted the feat/dif-info-debug branch December 18, 2020 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants